import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
  {
    title: '选项卡名称',
    dataIndex: 'tagName',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 150,
    ellipsis: true,
    resizable: true,
    customRender: ({ text }) => {
      return text == 'simple'
        ? '链接型'
        : text == 'query'
        ? '查询型'
        : text == 'module'
        ? '模块型'
        : '';
    },
  },
  {
    title: '顺序',
    dataIndex: 'tagOrder',
    width: 80,
    ellipsis: true,
    resizable: true,
  },
];

export const searchFormSchema: FormSchema[] = [];

export const viewList = [
  {
    label: '默认',
    value: '0',
  },
  {
    label: '日历看板',
    value: '5',
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'tagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'newTagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'relateCode',
    label: '模块',
    required: true,
    component: 'ApiSelect',
    colProps: { span: 24 },
    slot: 'relateCode',
  },
  {
    field: 'fieldSource',
    label: '主键',
    component: 'Input',
    colProps: { span: 24 },
    slot: 'fieldSource',
  },
  {
    field: 'fieldOtherRelated',
    label: '条件',
    component: 'Checkbox',
    defaultValue: true,
    colProps: { span: 24 },
    slot: 'fieldOtherRelated',
  },
  // {
  //   field: 'relateDesc',
  //   label: '条件字段',
  //   component: 'Input',
  //   colProps: { span: 24 },
  //   render: ({ values }) => values.relateDesc,
  // },
  {
    field: 'viewList',
    label: '视图',
    component: 'Select',
    colProps: { span: 24 },
    helpMessage: '如果选择看板，则需在模块中配置相关参数',
    componentProps: {
      options: viewList,
    },
    slot: 'viewList',
    ifShow: false,
  },
  {
    field: 'cwsStatus',
    label: '状态',
    component: 'Select',
    colProps: { span: 24 },
    defaultValue: '1',
    componentProps: {
      options: [
        {
          label: '不限',
          value: '-100',
        },
        {
          label: '流程已结束',
          value: '1',
        },
        {
          label: '流程未走完',
          value: '0',
        },
        {
          label: '流程被拒绝',
          value: '-2',
        },
        {
          label: '流程被放弃',
          value: '-3',
        },
      ],
    },
  },
  {
    field: 'tagOrder',
    label: '顺序',
    required: true,
    component: 'InputNumber',
    colProps: { span: 24 },
  },
  {
    field: 'conds',
    label: '显示条件',
    component: 'InputNumber',
    colProps: { span: 24 },
    helpMessage: '当满足条件时，显示选项卡',
    slot: 'conds',
  },
];
export const formSchema2: FormSchema[] = [
  {
    field: 'tagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'newTagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'tagUrl',
    label: '链接',
    component: 'Input',
    required: true,
    helpMessage: '$code替换为模块编码, $formCode替换为表单编码, $cwsId替换为记录的ID',
    colProps: { span: 24 },
  },
  {
    field: 'tagOrder',
    label: '顺序',
    component: 'InputNumber',
    required: true,
    colProps: { span: 24 },
  },
  // {
  //   field: 'conds',
  //   label: '显示条件',
  //   component: 'InputNumber',
  //   colProps: { span: 24 },
  //   helpMessage: '当满足条件时，显示选项卡',
  //   slot: 'conds',
  //   ifShow: false,
  // },
];
export const formSchema3: FormSchema[] = [
  {
    field: 'tagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'newTagName',
    label: '名称',
    required: true,
    component: 'Input',
    colProps: { span: 24 },
  },
  {
    field: 'queryName',
    label: '查询',
    component: 'Input',
    colProps: { span: 24 },
    slot: 'queryName',
  },
  {
    field: 'mapping',
    label: '映射',
    component: 'Input',
    colProps: { span: 24 },
    slot: 'mapping',
  },
  // {
  //   field: 'queryFieldDesc',
  //   label: '条件字段',
  //   component: 'Input',
  //   colProps: { span: 24 },
  //   render: ({ values }) => values.queryFieldDesc,
  // },
  {
    field: 'tagOrder',
    label: '顺序',
    required: true,
    component: 'InputNumber',
    colProps: { span: 24 },
  },
  {
    field: 'conds',
    label: '显示条件',
    component: 'InputNumber',
    colProps: { span: 24 },
    helpMessage: '当满足条件时，显示选项卡',
    slot: 'conds',
    ifShow: false,
  },
];
export const otherFormFields = [
  {
    label: 'ID',
    value: 'id',
  },
  {
    label: 'cws_id(关联主模块ID)',
    value: 'cws_id',
  },
  {
    label: '无',
    value: '',
  },
];
